<template>
    <scroll-view 
        :scroll-y="true"
        class="yf_detailtwo_view">
        <view class="container">
            <view class="title el-after">
                当前病人信息
            </view>
            <view class="one">
                <view class="top">
                    <view>
                        挂号单：{{rid}}
                    </view>
                    <view>
                        姓名：{{name}}
                    </view>
                </view>            
            </view>
            <u-table>
                <u-tr>
                    <u-th>药品名称</u-th>
                    <u-th>单价</u-th>
                    <u-th>药品数量</u-th>
                </u-tr>
                <view class="table_container">
                    <u-tr 
                        v-for="(item,index) in dataList" 
                        :key="index">
                        <u-td>{{item['药品名称']}}</u-td>
                        <u-td>{{item['单价']}}</u-td>
                        <u-td>{{item['数量']}}</u-td>
                    </u-tr>
                </view>
            </u-table>
            <u-toast ref="uToast" />
        </view>
    </scroll-view>
</template>

<script>
//药房已发药视图
import {getPayUpDrugs} from "@/common/api";
export default {
    data() {
        return {
            loading:false,
            rid:'',  //挂单号
            name:'',  //用户姓名
            dataList:[],  //药单列表
        };
    },
    onLoad(option) {  //路由参数
        this.rid = option.rid;
        this.name = option.name;
        this.getPayUpDrugs();
    },
    methods: {
        getPayUpDrugs(){  //获取当前病人的药单
            getPayUpDrugs(
                {
                    rid:this.rid,
                },
            ).then(data=>{
                this.dataList = data;
            });
        },
    },
}
</script>
<style scoped lang="scss">
.yf_detailtwo_view{
    height: calc(100vh);
    .container{
        padding: 35rpx;
        box-sizing: border-box;
        .title{
            width: fit-content;
            font-size: 45rpx;
            color: #000000;
            font-weight: bold;
            margin-bottom: 35rpx;
        }
        >.one{
            box-sizing: border-box;
            display: grid;
            grid-gap: 35rpx;
            font-size: 30rpx;
            margin-bottom: 35rpx;
            >.top{
                display: grid;
                grid-template-columns: 1fr 1fr;
            }
            >.content{
                display: grid;
                grid-template-columns: 1fr 2fr;
            }
        }
        .u-table{
            margin-top: 35rpx;
            display: block;
        }
    }
}
</style>
